<?php
require "MyRabbitMq.php";

use MyRabbitMq\MyRabbitMq;
use \PhpAmqpLib\Message\AMQPMessage;

$rabbit = new MyRabbitMq();
$rabbit->setExchange('ex1',\PhpAmqpLib\Exchange\AMQPExchangeType::DIRECT,false,true);
$rabbit->setQueue('qu1',false,true);
$rabbit->bindQueueExchange('qu1','ex1','key1');
$callback = function (AMQPMessage $message) {
    echo $message->body . PHP_EOL;
    usleep(5000);
};
$rabbit->consume('qu1',$callback,false,false,true);

while($ch->is_consuming()){
    $ch->wait();
}
$rabbit->close();